//
//  MonitorRealTableViewCell.m
//  CityFire
//
//  Created by liuyangzhu on 2017/8/17.
//  Copyright © 2017年 刘养柱. All rights reserved.
//

#import "MonitorRealTableViewCell.h"

@interface MonitorRealTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *deviceNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *deviceNoLabel;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UILabel *sourceLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *deviceTypeLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@property (weak, nonatomic) IBOutlet UIView *moreResultView;
@property (weak, nonatomic) IBOutlet UIButton *selectMoreButton;

@end

@implementation MonitorRealTableViewCell

- (void)setMonitorModel:(MonitorModel *)monitorModel
{
    self.deviceNameLabel.text = monitorModel.deviceName;
    self.deviceNoLabel.text = [NSString stringWithFormat:@"设备编号:%ld", monitorModel.deviceCode];
    //    [UIColor colorWithRed: / 255.0 green:/ 255.0 blue: / 255.0 alpha:1.0f]
    self.statusLabel.text = monitorModel.misinformation;
    self.statusLabel.textColor = [monitorModel.misinformation containsString:@"否"] ? [UIColor orangeColor] : [UIColor greenColor];
    self.sourceLabel.text = monitorModel.record1;
    self.contentLabel.text = monitorModel.record3;
    self.deviceTypeLabel.text = monitorModel.record2;
    NSString *str = [NSString stringWithFormat:@"%ld",monitorModel.timeHistory];
    NSString *breaktime = [NSString timeWithTimeIntervalString:str];
    self.timeLabel.text = breaktime;
    
    if (self.isShowMoreResult) {
        self.moreResultView.hidden=NO;
    } else {
        self.moreResultView.hidden=YES;
    }
}
- (IBAction)selectButtonClick:(id)sender {
    
    if(self.selectMoreButton.isSelected){
        [self.selectMoreButton setSelected:NO];
        self.monitorModel.isSelect=NO;
    }else{
        [self.selectMoreButton setSelected:YES];
        self.monitorModel.isSelect=YES;
    }
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
